var app = angular.module("app", []);

app.provider("game4", function() {
	var name;
	return {
		setName: function(value) {
			name = value;
		},
		$get: function() {
			return {
				title: name + " is awesome!"
			};
		}
	};
});

app.config(['$provide', 'game4Provider', function($provide, game4Provider) {
	$provide.factory("game2", function() {
		return {
			title: "Warcraft"
		};
	});
	$provide.provider("game3", function() {
		return {
			$get: function() {
				return {
					title: "WinningEleven"
				};
			}
		};
	});
	game4Provider.setName('StarCraft');
}]);



app.factory("game1", function() {
	return {
		title: "StarCraft"
	};
});

app.controller("AppCtrl", ['$scope', 'game1', 'game2', 'game3', 'game4', function($scope, game1, game2, game3, game4) {
	$scope.games = [];
	$scope.games.push(game1.title);
	$scope.games.push(game2.title);
	$scope.games.push(game3.title);
	$scope.title = game4.title;
}]);